# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Analytics.V3.Api.Management do
  @moduledoc """
  API calls for all endpoints tagged `Management`.
  """

  alias GoogleApi.Analytics.V3.Connection
  alias GoogleApi.Gax.{Request, Response}

  @library_version Mix.Project.config() |> Keyword.get(:version, "")

  @doc """
  Lists account summaries (lightweight tree comprised of accounts/properties/profiles) to which the user has access.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:"max-results"` (*type:* `integer()`) - The maximum number of account summaries to include in this response, where the largest acceptable value is 1000.
      *   `:"start-index"` (*type:* `integer()`) - An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.AccountSummaries{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_account_summaries_list(Tesla.Env.client(), keyword(), keyword()) ::
          {:ok, GoogleApi.Analytics.V3.Model.AccountSummaries.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_account_summaries_list(connection, optional_params \\ [], opts \\ []) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :"max-results" => :query,
      :"start-index" => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url("/analytics/v3/management/accountSummaries", %{})
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.AccountSummaries{}])
  end

  @doc """
  Removes a user from the given account.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID to delete the user link for.
  *   `link_id` (*type:* `String.t`) - Link ID to delete the user link for.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_account_user_links_delete(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) :: {:ok, nil} | {:ok, Tesla.Env.t()} | {:ok, list()} | {:error, any()}
  def analytics_management_account_user_links_delete(
        connection,
        account_id,
        link_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query
    }

    request =
      Request.new()
      |> Request.method(:delete)
      |> Request.url("/analytics/v3/management/accounts/{accountId}/entityUserLinks/{linkId}", %{
        "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
        "linkId" => URI.encode(link_id, &(URI.char_unreserved?(&1) || &1 == ?/))
      })
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [decode: false])
  end

  @doc """
  Adds a new user to the given account.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID to create the user link for.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:body` (*type:* `GoogleApi.Analytics.V3.Model.EntityUserLink.t`) - 
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.EntityUserLink{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_account_user_links_insert(
          Tesla.Env.client(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.EntityUserLink.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_account_user_links_insert(
        connection,
        account_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :body => :body
    }

    request =
      Request.new()
      |> Request.method(:post)
      |> Request.url("/analytics/v3/management/accounts/{accountId}/entityUserLinks", %{
        "accountId" => URI.encode(account_id, &URI.char_unreserved?/1)
      })
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.EntityUserLink{}])
  end

  @doc """
  Lists account-user links for a given account.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID to retrieve the user links for.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:"max-results"` (*type:* `integer()`) - The maximum number of account-user links to include in this response.
      *   `:"start-index"` (*type:* `integer()`) - An index of the first account-user link to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.EntityUserLinks{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_account_user_links_list(
          Tesla.Env.client(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.EntityUserLinks.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_account_user_links_list(
        connection,
        account_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :"max-results" => :query,
      :"start-index" => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url("/analytics/v3/management/accounts/{accountId}/entityUserLinks", %{
        "accountId" => URI.encode(account_id, &URI.char_unreserved?/1)
      })
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.EntityUserLinks{}])
  end

  @doc """
  Updates permissions for an existing user on the given account.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID to update the account-user link for.
  *   `link_id` (*type:* `String.t`) - Link ID to update the account-user link for.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:body` (*type:* `GoogleApi.Analytics.V3.Model.EntityUserLink.t`) - 
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.EntityUserLink{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_account_user_links_update(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.EntityUserLink.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_account_user_links_update(
        connection,
        account_id,
        link_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :body => :body
    }

    request =
      Request.new()
      |> Request.method(:put)
      |> Request.url("/analytics/v3/management/accounts/{accountId}/entityUserLinks/{linkId}", %{
        "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
        "linkId" => URI.encode(link_id, &(URI.char_unreserved?(&1) || &1 == ?/))
      })
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.EntityUserLink{}])
  end

  @doc """
  Lists all accounts to which the user has access.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:"max-results"` (*type:* `integer()`) - The maximum number of accounts to include in this response.
      *   `:"start-index"` (*type:* `integer()`) - An index of the first account to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.Accounts{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_accounts_list(Tesla.Env.client(), keyword(), keyword()) ::
          {:ok, GoogleApi.Analytics.V3.Model.Accounts.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_accounts_list(connection, optional_params \\ [], opts \\ []) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :"max-results" => :query,
      :"start-index" => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url("/analytics/v3/management/accounts", %{})
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.Accounts{}])
  end

  @doc """
  Hashes the given Client ID.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:body` (*type:* `GoogleApi.Analytics.V3.Model.HashClientIdRequest.t`) - 
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.HashClientIdResponse{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_client_id_hash_client_id(Tesla.Env.client(), keyword(), keyword()) ::
          {:ok, GoogleApi.Analytics.V3.Model.HashClientIdResponse.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_client_id_hash_client_id(connection, optional_params \\ [], opts \\ []) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :body => :body
    }

    request =
      Request.new()
      |> Request.method(:post)
      |> Request.url("/analytics/v3/management/clientId:hashClientId", %{})
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.HashClientIdResponse{}])
  end

  @doc """
  List custom data sources to which the user has access.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account Id for the custom data sources to retrieve.
  *   `web_property_id` (*type:* `String.t`) - Web property Id for the custom data sources to retrieve.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:"max-results"` (*type:* `integer()`) - The maximum number of custom data sources to include in this response.
      *   `:"start-index"` (*type:* `integer()`) - A 1-based index of the first custom data source to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.CustomDataSources{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_custom_data_sources_list(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.CustomDataSources.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_custom_data_sources_list(
        connection,
        account_id,
        web_property_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :"max-results" => :query,
      :"start-index" => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/customDataSources",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1)
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.CustomDataSources{}])
  end

  @doc """
  Get a custom dimension to which the user has access.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID for the custom dimension to retrieve.
  *   `web_property_id` (*type:* `String.t`) - Web property ID for the custom dimension to retrieve.
  *   `custom_dimension_id` (*type:* `String.t`) - The ID of the custom dimension to retrieve.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.CustomDimension{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_custom_dimensions_get(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.CustomDimension.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_custom_dimensions_get(
        connection,
        account_id,
        web_property_id,
        custom_dimension_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/customDimensions/{customDimensionId}",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1),
          "customDimensionId" =>
            URI.encode(custom_dimension_id, &(URI.char_unreserved?(&1) || &1 == ?/))
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.CustomDimension{}])
  end

  @doc """
  Create a new custom dimension.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID for the custom dimension to create.
  *   `web_property_id` (*type:* `String.t`) - Web property ID for the custom dimension to create.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:body` (*type:* `GoogleApi.Analytics.V3.Model.CustomDimension.t`) - 
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.CustomDimension{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_custom_dimensions_insert(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.CustomDimension.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_custom_dimensions_insert(
        connection,
        account_id,
        web_property_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :body => :body
    }

    request =
      Request.new()
      |> Request.method(:post)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/customDimensions",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1)
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.CustomDimension{}])
  end

  @doc """
  Lists custom dimensions to which the user has access.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID for the custom dimensions to retrieve.
  *   `web_property_id` (*type:* `String.t`) - Web property ID for the custom dimensions to retrieve.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:"max-results"` (*type:* `integer()`) - The maximum number of custom dimensions to include in this response.
      *   `:"start-index"` (*type:* `integer()`) - An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.CustomDimensions{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_custom_dimensions_list(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.CustomDimensions.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_custom_dimensions_list(
        connection,
        account_id,
        web_property_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :"max-results" => :query,
      :"start-index" => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/customDimensions",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1)
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.CustomDimensions{}])
  end

  @doc """
  Updates an existing custom dimension. This method supports patch semantics.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID for the custom dimension to update.
  *   `web_property_id` (*type:* `String.t`) - Web property ID for the custom dimension to update.
  *   `custom_dimension_id` (*type:* `String.t`) - Custom dimension ID for the custom dimension to update.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:ignoreCustomDataSourceLinks` (*type:* `boolean()`) - Force the update and ignore any warnings related to the custom dimension being linked to a custom data source / data set.
      *   `:body` (*type:* `GoogleApi.Analytics.V3.Model.CustomDimension.t`) - 
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.CustomDimension{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_custom_dimensions_patch(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.CustomDimension.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_custom_dimensions_patch(
        connection,
        account_id,
        web_property_id,
        custom_dimension_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :ignoreCustomDataSourceLinks => :query,
      :body => :body
    }

    request =
      Request.new()
      |> Request.method(:patch)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/customDimensions/{customDimensionId}",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1),
          "customDimensionId" =>
            URI.encode(custom_dimension_id, &(URI.char_unreserved?(&1) || &1 == ?/))
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.CustomDimension{}])
  end

  @doc """
  Updates an existing custom dimension.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID for the custom dimension to update.
  *   `web_property_id` (*type:* `String.t`) - Web property ID for the custom dimension to update.
  *   `custom_dimension_id` (*type:* `String.t`) - Custom dimension ID for the custom dimension to update.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:ignoreCustomDataSourceLinks` (*type:* `boolean()`) - Force the update and ignore any warnings related to the custom dimension being linked to a custom data source / data set.
      *   `:body` (*type:* `GoogleApi.Analytics.V3.Model.CustomDimension.t`) - 
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.CustomDimension{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_custom_dimensions_update(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.CustomDimension.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_custom_dimensions_update(
        connection,
        account_id,
        web_property_id,
        custom_dimension_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :ignoreCustomDataSourceLinks => :query,
      :body => :body
    }

    request =
      Request.new()
      |> Request.method(:put)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/customDimensions/{customDimensionId}",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1),
          "customDimensionId" =>
            URI.encode(custom_dimension_id, &(URI.char_unreserved?(&1) || &1 == ?/))
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.CustomDimension{}])
  end

  @doc """
  Get a custom metric to which the user has access.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID for the custom metric to retrieve.
  *   `web_property_id` (*type:* `String.t`) - Web property ID for the custom metric to retrieve.
  *   `custom_metric_id` (*type:* `String.t`) - The ID of the custom metric to retrieve.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.CustomMetric{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_custom_metrics_get(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.CustomMetric.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_custom_metrics_get(
        connection,
        account_id,
        web_property_id,
        custom_metric_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/customMetrics/{customMetricId}",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1),
          "customMetricId" =>
            URI.encode(custom_metric_id, &(URI.char_unreserved?(&1) || &1 == ?/))
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.CustomMetric{}])
  end

  @doc """
  Create a new custom metric.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID for the custom metric to create.
  *   `web_property_id` (*type:* `String.t`) - Web property ID for the custom dimension to create.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:body` (*type:* `GoogleApi.Analytics.V3.Model.CustomMetric.t`) - 
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.CustomMetric{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_custom_metrics_insert(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.CustomMetric.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_custom_metrics_insert(
        connection,
        account_id,
        web_property_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :body => :body
    }

    request =
      Request.new()
      |> Request.method(:post)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/customMetrics",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1)
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.CustomMetric{}])
  end

  @doc """
  Lists custom metrics to which the user has access.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID for the custom metrics to retrieve.
  *   `web_property_id` (*type:* `String.t`) - Web property ID for the custom metrics to retrieve.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:"max-results"` (*type:* `integer()`) - The maximum number of custom metrics to include in this response.
      *   `:"start-index"` (*type:* `integer()`) - An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.CustomMetrics{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_custom_metrics_list(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.CustomMetrics.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_custom_metrics_list(
        connection,
        account_id,
        web_property_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :"max-results" => :query,
      :"start-index" => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/customMetrics",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1)
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.CustomMetrics{}])
  end

  @doc """
  Updates an existing custom metric. This method supports patch semantics.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID for the custom metric to update.
  *   `web_property_id` (*type:* `String.t`) - Web property ID for the custom metric to update.
  *   `custom_metric_id` (*type:* `String.t`) - Custom metric ID for the custom metric to update.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:ignoreCustomDataSourceLinks` (*type:* `boolean()`) - Force the update and ignore any warnings related to the custom metric being linked to a custom data source / data set.
      *   `:body` (*type:* `GoogleApi.Analytics.V3.Model.CustomMetric.t`) - 
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.CustomMetric{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_custom_metrics_patch(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.CustomMetric.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_custom_metrics_patch(
        connection,
        account_id,
        web_property_id,
        custom_metric_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :ignoreCustomDataSourceLinks => :query,
      :body => :body
    }

    request =
      Request.new()
      |> Request.method(:patch)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/customMetrics/{customMetricId}",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1),
          "customMetricId" =>
            URI.encode(custom_metric_id, &(URI.char_unreserved?(&1) || &1 == ?/))
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.CustomMetric{}])
  end

  @doc """
  Updates an existing custom metric.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID for the custom metric to update.
  *   `web_property_id` (*type:* `String.t`) - Web property ID for the custom metric to update.
  *   `custom_metric_id` (*type:* `String.t`) - Custom metric ID for the custom metric to update.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:ignoreCustomDataSourceLinks` (*type:* `boolean()`) - Force the update and ignore any warnings related to the custom metric being linked to a custom data source / data set.
      *   `:body` (*type:* `GoogleApi.Analytics.V3.Model.CustomMetric.t`) - 
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.CustomMetric{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_custom_metrics_update(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.CustomMetric.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_custom_metrics_update(
        connection,
        account_id,
        web_property_id,
        custom_metric_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :ignoreCustomDataSourceLinks => :query,
      :body => :body
    }

    request =
      Request.new()
      |> Request.method(:put)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/customMetrics/{customMetricId}",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1),
          "customMetricId" =>
            URI.encode(custom_metric_id, &(URI.char_unreserved?(&1) || &1 == ?/))
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.CustomMetric{}])
  end

  @doc """
  Delete an experiment.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID to which the experiment belongs
  *   `web_property_id` (*type:* `String.t`) - Web property ID to which the experiment belongs
  *   `profile_id` (*type:* `String.t`) - View (Profile) ID to which the experiment belongs
  *   `experiment_id` (*type:* `String.t`) - ID of the experiment to delete
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_experiments_delete(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) :: {:ok, nil} | {:ok, Tesla.Env.t()} | {:ok, list()} | {:error, any()}
  def analytics_management_experiments_delete(
        connection,
        account_id,
        web_property_id,
        profile_id,
        experiment_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query
    }

    request =
      Request.new()
      |> Request.method(:delete)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/experiments/{experimentId}",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1),
          "profileId" => URI.encode(profile_id, &URI.char_unreserved?/1),
          "experimentId" => URI.encode(experiment_id, &(URI.char_unreserved?(&1) || &1 == ?/))
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [decode: false])
  end

  @doc """
  Returns an experiment to which the user has access.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID to retrieve the experiment for.
  *   `web_property_id` (*type:* `String.t`) - Web property ID to retrieve the experiment for.
  *   `profile_id` (*type:* `String.t`) - View (Profile) ID to retrieve the experiment for.
  *   `experiment_id` (*type:* `String.t`) - Experiment ID to retrieve the experiment for.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.Experiment{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_experiments_get(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.Experiment.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_experiments_get(
        connection,
        account_id,
        web_property_id,
        profile_id,
        experiment_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/experiments/{experimentId}",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1),
          "profileId" => URI.encode(profile_id, &URI.char_unreserved?/1),
          "experimentId" => URI.encode(experiment_id, &(URI.char_unreserved?(&1) || &1 == ?/))
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.Experiment{}])
  end

  @doc """
  Create a new experiment.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID to create the experiment for.
  *   `web_property_id` (*type:* `String.t`) - Web property ID to create the experiment for.
  *   `profile_id` (*type:* `String.t`) - View (Profile) ID to create the experiment for.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:body` (*type:* `GoogleApi.Analytics.V3.Model.Experiment.t`) - 
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.Experiment{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_experiments_insert(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.Experiment.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_experiments_insert(
        connection,
        account_id,
        web_property_id,
        profile_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :body => :body
    }

    request =
      Request.new()
      |> Request.method(:post)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/experiments",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1),
          "profileId" => URI.encode(profile_id, &URI.char_unreserved?/1)
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.Experiment{}])
  end

  @doc """
  Lists experiments to which the user has access.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID to retrieve experiments for.
  *   `web_property_id` (*type:* `String.t`) - Web property ID to retrieve experiments for.
  *   `profile_id` (*type:* `String.t`) - View (Profile) ID to retrieve experiments for.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:"max-results"` (*type:* `integer()`) - The maximum number of experiments to include in this response.
      *   `:"start-index"` (*type:* `integer()`) - An index of the first experiment to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.Experiments{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_experiments_list(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.Experiments.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_experiments_list(
        connection,
        account_id,
        web_property_id,
        profile_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :"max-results" => :query,
      :"start-index" => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/experiments",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1),
          "profileId" => URI.encode(profile_id, &URI.char_unreserved?/1)
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.Experiments{}])
  end

  @doc """
  Update an existing experiment. This method supports patch semantics.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID of the experiment to update.
  *   `web_property_id` (*type:* `String.t`) - Web property ID of the experiment to update.
  *   `profile_id` (*type:* `String.t`) - View (Profile) ID of the experiment to update.
  *   `experiment_id` (*type:* `String.t`) - Experiment ID of the experiment to update.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:body` (*type:* `GoogleApi.Analytics.V3.Model.Experiment.t`) - 
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.Experiment{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_experiments_patch(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.Experiment.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_experiments_patch(
        connection,
        account_id,
        web_property_id,
        profile_id,
        experiment_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :body => :body
    }

    request =
      Request.new()
      |> Request.method(:patch)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/experiments/{experimentId}",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1),
          "profileId" => URI.encode(profile_id, &URI.char_unreserved?/1),
          "experimentId" => URI.encode(experiment_id, &(URI.char_unreserved?(&1) || &1 == ?/))
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.Experiment{}])
  end

  @doc """
  Update an existing experiment.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID of the experiment to update.
  *   `web_property_id` (*type:* `String.t`) - Web property ID of the experiment to update.
  *   `profile_id` (*type:* `String.t`) - View (Profile) ID of the experiment to update.
  *   `experiment_id` (*type:* `String.t`) - Experiment ID of the experiment to update.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:body` (*type:* `GoogleApi.Analytics.V3.Model.Experiment.t`) - 
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.Experiment{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_experiments_update(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.Experiment.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_experiments_update(
        connection,
        account_id,
        web_property_id,
        profile_id,
        experiment_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :body => :body
    }

    request =
      Request.new()
      |> Request.method(:put)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/experiments/{experimentId}",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1),
          "profileId" => URI.encode(profile_id, &URI.char_unreserved?/1),
          "experimentId" => URI.encode(experiment_id, &(URI.char_unreserved?(&1) || &1 == ?/))
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.Experiment{}])
  end

  @doc """
  Delete a filter.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID to delete the filter for.
  *   `filter_id` (*type:* `String.t`) - ID of the filter to be deleted.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.Filter{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_filters_delete(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.Filter.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_filters_delete(
        connection,
        account_id,
        filter_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query
    }

    request =
      Request.new()
      |> Request.method(:delete)
      |> Request.url("/analytics/v3/management/accounts/{accountId}/filters/{filterId}", %{
        "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
        "filterId" => URI.encode(filter_id, &(URI.char_unreserved?(&1) || &1 == ?/))
      })
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.Filter{}])
  end

  @doc """
  Returns filters to which the user has access.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID to retrieve filters for.
  *   `filter_id` (*type:* `String.t`) - Filter ID to retrieve filters for.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.Filter{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_filters_get(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.Filter.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_filters_get(
        connection,
        account_id,
        filter_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url("/analytics/v3/management/accounts/{accountId}/filters/{filterId}", %{
        "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
        "filterId" => URI.encode(filter_id, &(URI.char_unreserved?(&1) || &1 == ?/))
      })
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.Filter{}])
  end

  @doc """
  Create a new filter.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID to create filter for.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:body` (*type:* `GoogleApi.Analytics.V3.Model.Filter.t`) - 
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.Filter{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_filters_insert(Tesla.Env.client(), String.t(), keyword(), keyword()) ::
          {:ok, GoogleApi.Analytics.V3.Model.Filter.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_filters_insert(
        connection,
        account_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :body => :body
    }

    request =
      Request.new()
      |> Request.method(:post)
      |> Request.url("/analytics/v3/management/accounts/{accountId}/filters", %{
        "accountId" => URI.encode(account_id, &URI.char_unreserved?/1)
      })
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.Filter{}])
  end

  @doc """
  Lists all filters for an account

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID to retrieve filters for.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:"max-results"` (*type:* `integer()`) - The maximum number of filters to include in this response.
      *   `:"start-index"` (*type:* `integer()`) - An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.Filters{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_filters_list(Tesla.Env.client(), String.t(), keyword(), keyword()) ::
          {:ok, GoogleApi.Analytics.V3.Model.Filters.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_filters_list(connection, account_id, optional_params \\ [], opts \\ []) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :"max-results" => :query,
      :"start-index" => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url("/analytics/v3/management/accounts/{accountId}/filters", %{
        "accountId" => URI.encode(account_id, &URI.char_unreserved?/1)
      })
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.Filters{}])
  end

  @doc """
  Updates an existing filter. This method supports patch semantics.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID to which the filter belongs.
  *   `filter_id` (*type:* `String.t`) - ID of the filter to be updated.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:body` (*type:* `GoogleApi.Analytics.V3.Model.Filter.t`) - 
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.Filter{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_filters_patch(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.Filter.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_filters_patch(
        connection,
        account_id,
        filter_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :body => :body
    }

    request =
      Request.new()
      |> Request.method(:patch)
      |> Request.url("/analytics/v3/management/accounts/{accountId}/filters/{filterId}", %{
        "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
        "filterId" => URI.encode(filter_id, &(URI.char_unreserved?(&1) || &1 == ?/))
      })
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.Filter{}])
  end

  @doc """
  Updates an existing filter.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID to which the filter belongs.
  *   `filter_id` (*type:* `String.t`) - ID of the filter to be updated.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:body` (*type:* `GoogleApi.Analytics.V3.Model.Filter.t`) - 
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.Filter{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_filters_update(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.Filter.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_filters_update(
        connection,
        account_id,
        filter_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :body => :body
    }

    request =
      Request.new()
      |> Request.method(:put)
      |> Request.url("/analytics/v3/management/accounts/{accountId}/filters/{filterId}", %{
        "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
        "filterId" => URI.encode(filter_id, &(URI.char_unreserved?(&1) || &1 == ?/))
      })
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.Filter{}])
  end

  @doc """
  Gets a goal to which the user has access.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID to retrieve the goal for.
  *   `web_property_id` (*type:* `String.t`) - Web property ID to retrieve the goal for.
  *   `profile_id` (*type:* `String.t`) - View (Profile) ID to retrieve the goal for.
  *   `goal_id` (*type:* `String.t`) - Goal ID to retrieve the goal for.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.Goal{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_goals_get(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.Goal.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_goals_get(
        connection,
        account_id,
        web_property_id,
        profile_id,
        goal_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/goals/{goalId}",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1),
          "profileId" => URI.encode(profile_id, &URI.char_unreserved?/1),
          "goalId" => URI.encode(goal_id, &(URI.char_unreserved?(&1) || &1 == ?/))
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.Goal{}])
  end

  @doc """
  Create a new goal.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID to create the goal for.
  *   `web_property_id` (*type:* `String.t`) - Web property ID to create the goal for.
  *   `profile_id` (*type:* `String.t`) - View (Profile) ID to create the goal for.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:body` (*type:* `GoogleApi.Analytics.V3.Model.Goal.t`) - 
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.Goal{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_goals_insert(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.Goal.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_goals_insert(
        connection,
        account_id,
        web_property_id,
        profile_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :body => :body
    }

    request =
      Request.new()
      |> Request.method(:post)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/goals",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1),
          "profileId" => URI.encode(profile_id, &URI.char_unreserved?/1)
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.Goal{}])
  end

  @doc """
  Lists goals to which the user has access.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID to retrieve goals for. Can either be a specific account ID or '~all', which refers to all the accounts that user has access to.
  *   `web_property_id` (*type:* `String.t`) - Web property ID to retrieve goals for. Can either be a specific web property ID or '~all', which refers to all the web properties that user has access to.
  *   `profile_id` (*type:* `String.t`) - View (Profile) ID to retrieve goals for. Can either be a specific view (profile) ID or '~all', which refers to all the views (profiles) that user has access to.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:"max-results"` (*type:* `integer()`) - The maximum number of goals to include in this response.
      *   `:"start-index"` (*type:* `integer()`) - An index of the first goal to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.Goals{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_goals_list(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.Goals.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_goals_list(
        connection,
        account_id,
        web_property_id,
        profile_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :"max-results" => :query,
      :"start-index" => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/goals",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1),
          "profileId" => URI.encode(profile_id, &URI.char_unreserved?/1)
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.Goals{}])
  end

  @doc """
  Updates an existing goal. This method supports patch semantics.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID to update the goal.
  *   `web_property_id` (*type:* `String.t`) - Web property ID to update the goal.
  *   `profile_id` (*type:* `String.t`) - View (Profile) ID to update the goal.
  *   `goal_id` (*type:* `String.t`) - Index of the goal to be updated.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:body` (*type:* `GoogleApi.Analytics.V3.Model.Goal.t`) - 
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.Goal{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_goals_patch(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.Goal.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_goals_patch(
        connection,
        account_id,
        web_property_id,
        profile_id,
        goal_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :body => :body
    }

    request =
      Request.new()
      |> Request.method(:patch)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/goals/{goalId}",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1),
          "profileId" => URI.encode(profile_id, &URI.char_unreserved?/1),
          "goalId" => URI.encode(goal_id, &(URI.char_unreserved?(&1) || &1 == ?/))
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.Goal{}])
  end

  @doc """
  Updates an existing goal.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID to update the goal.
  *   `web_property_id` (*type:* `String.t`) - Web property ID to update the goal.
  *   `profile_id` (*type:* `String.t`) - View (Profile) ID to update the goal.
  *   `goal_id` (*type:* `String.t`) - Index of the goal to be updated.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:body` (*type:* `GoogleApi.Analytics.V3.Model.Goal.t`) - 
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.Goal{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_goals_update(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.Goal.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_goals_update(
        connection,
        account_id,
        web_property_id,
        profile_id,
        goal_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :body => :body
    }

    request =
      Request.new()
      |> Request.method(:put)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/goals/{goalId}",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1),
          "profileId" => URI.encode(profile_id, &URI.char_unreserved?/1),
          "goalId" => URI.encode(goal_id, &(URI.char_unreserved?(&1) || &1 == ?/))
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.Goal{}])
  end

  @doc """
  Delete a profile filter link.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID to which the profile filter link belongs.
  *   `web_property_id` (*type:* `String.t`) - Web property Id to which the profile filter link belongs.
  *   `profile_id` (*type:* `String.t`) - Profile ID to which the filter link belongs.
  *   `link_id` (*type:* `String.t`) - ID of the profile filter link to delete.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_profile_filter_links_delete(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) :: {:ok, nil} | {:ok, Tesla.Env.t()} | {:ok, list()} | {:error, any()}
  def analytics_management_profile_filter_links_delete(
        connection,
        account_id,
        web_property_id,
        profile_id,
        link_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query
    }

    request =
      Request.new()
      |> Request.method(:delete)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/profileFilterLinks/{linkId}",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1),
          "profileId" => URI.encode(profile_id, &URI.char_unreserved?/1),
          "linkId" => URI.encode(link_id, &(URI.char_unreserved?(&1) || &1 == ?/))
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [decode: false])
  end

  @doc """
  Returns a single profile filter link.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID to retrieve profile filter link for.
  *   `web_property_id` (*type:* `String.t`) - Web property Id to retrieve profile filter link for.
  *   `profile_id` (*type:* `String.t`) - Profile ID to retrieve filter link for.
  *   `link_id` (*type:* `String.t`) - ID of the profile filter link.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.ProfileFilterLink{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_profile_filter_links_get(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.ProfileFilterLink.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_profile_filter_links_get(
        connection,
        account_id,
        web_property_id,
        profile_id,
        link_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/profileFilterLinks/{linkId}",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1),
          "profileId" => URI.encode(profile_id, &URI.char_unreserved?/1),
          "linkId" => URI.encode(link_id, &(URI.char_unreserved?(&1) || &1 == ?/))
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.ProfileFilterLink{}])
  end

  @doc """
  Create a new profile filter link.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID to create profile filter link for.
  *   `web_property_id` (*type:* `String.t`) - Web property Id to create profile filter link for.
  *   `profile_id` (*type:* `String.t`) - Profile ID to create filter link for.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:body` (*type:* `GoogleApi.Analytics.V3.Model.ProfileFilterLink.t`) - 
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.ProfileFilterLink{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_profile_filter_links_insert(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.ProfileFilterLink.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_profile_filter_links_insert(
        connection,
        account_id,
        web_property_id,
        profile_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :body => :body
    }

    request =
      Request.new()
      |> Request.method(:post)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/profileFilterLinks",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1),
          "profileId" => URI.encode(profile_id, &URI.char_unreserved?/1)
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.ProfileFilterLink{}])
  end

  @doc """
  Lists all profile filter links for a profile.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID to retrieve profile filter links for.
  *   `web_property_id` (*type:* `String.t`) - Web property Id for profile filter links for. Can either be a specific web property ID or '~all', which refers to all the web properties that user has access to.
  *   `profile_id` (*type:* `String.t`) - Profile ID to retrieve filter links for. Can either be a specific profile ID or '~all', which refers to all the profiles that user has access to.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:"max-results"` (*type:* `integer()`) - The maximum number of profile filter links to include in this response.
      *   `:"start-index"` (*type:* `integer()`) - An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.ProfileFilterLinks{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_profile_filter_links_list(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.ProfileFilterLinks.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_profile_filter_links_list(
        connection,
        account_id,
        web_property_id,
        profile_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :"max-results" => :query,
      :"start-index" => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/profileFilterLinks",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1),
          "profileId" => URI.encode(profile_id, &URI.char_unreserved?/1)
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.ProfileFilterLinks{}])
  end

  @doc """
  Update an existing profile filter link. This method supports patch semantics.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID to which profile filter link belongs.
  *   `web_property_id` (*type:* `String.t`) - Web property Id to which profile filter link belongs
  *   `profile_id` (*type:* `String.t`) - Profile ID to which filter link belongs
  *   `link_id` (*type:* `String.t`) - ID of the profile filter link to be updated.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:body` (*type:* `GoogleApi.Analytics.V3.Model.ProfileFilterLink.t`) - 
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.ProfileFilterLink{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_profile_filter_links_patch(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.ProfileFilterLink.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_profile_filter_links_patch(
        connection,
        account_id,
        web_property_id,
        profile_id,
        link_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :body => :body
    }

    request =
      Request.new()
      |> Request.method(:patch)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/profileFilterLinks/{linkId}",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1),
          "profileId" => URI.encode(profile_id, &URI.char_unreserved?/1),
          "linkId" => URI.encode(link_id, &(URI.char_unreserved?(&1) || &1 == ?/))
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.ProfileFilterLink{}])
  end

  @doc """
  Update an existing profile filter link.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID to which profile filter link belongs.
  *   `web_property_id` (*type:* `String.t`) - Web property Id to which profile filter link belongs
  *   `profile_id` (*type:* `String.t`) - Profile ID to which filter link belongs
  *   `link_id` (*type:* `String.t`) - ID of the profile filter link to be updated.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:body` (*type:* `GoogleApi.Analytics.V3.Model.ProfileFilterLink.t`) - 
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.ProfileFilterLink{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_profile_filter_links_update(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.ProfileFilterLink.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_profile_filter_links_update(
        connection,
        account_id,
        web_property_id,
        profile_id,
        link_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :body => :body
    }

    request =
      Request.new()
      |> Request.method(:put)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/profileFilterLinks/{linkId}",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1),
          "profileId" => URI.encode(profile_id, &URI.char_unreserved?/1),
          "linkId" => URI.encode(link_id, &(URI.char_unreserved?(&1) || &1 == ?/))
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.ProfileFilterLink{}])
  end

  @doc """
  Removes a user from the given view (profile).

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID to delete the user link for.
  *   `web_property_id` (*type:* `String.t`) - Web Property ID to delete the user link for.
  *   `profile_id` (*type:* `String.t`) - View (Profile) ID to delete the user link for.
  *   `link_id` (*type:* `String.t`) - Link ID to delete the user link for.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_profile_user_links_delete(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) :: {:ok, nil} | {:ok, Tesla.Env.t()} | {:ok, list()} | {:error, any()}
  def analytics_management_profile_user_links_delete(
        connection,
        account_id,
        web_property_id,
        profile_id,
        link_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query
    }

    request =
      Request.new()
      |> Request.method(:delete)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/entityUserLinks/{linkId}",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1),
          "profileId" => URI.encode(profile_id, &URI.char_unreserved?/1),
          "linkId" => URI.encode(link_id, &(URI.char_unreserved?(&1) || &1 == ?/))
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [decode: false])
  end

  @doc """
  Adds a new user to the given view (profile).

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID to create the user link for.
  *   `web_property_id` (*type:* `String.t`) - Web Property ID to create the user link for.
  *   `profile_id` (*type:* `String.t`) - View (Profile) ID to create the user link for.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:body` (*type:* `GoogleApi.Analytics.V3.Model.EntityUserLink.t`) - 
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.EntityUserLink{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_profile_user_links_insert(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.EntityUserLink.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_profile_user_links_insert(
        connection,
        account_id,
        web_property_id,
        profile_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :body => :body
    }

    request =
      Request.new()
      |> Request.method(:post)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/entityUserLinks",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1),
          "profileId" => URI.encode(profile_id, &URI.char_unreserved?/1)
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.EntityUserLink{}])
  end

  @doc """
  Lists profile-user links for a given view (profile).

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID which the given view (profile) belongs to.
  *   `web_property_id` (*type:* `String.t`) - Web Property ID which the given view (profile) belongs to. Can either be a specific web property ID or '~all', which refers to all the web properties that user has access to.
  *   `profile_id` (*type:* `String.t`) - View (Profile) ID to retrieve the profile-user links for. Can either be a specific profile ID or '~all', which refers to all the profiles that user has access to.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:"max-results"` (*type:* `integer()`) - The maximum number of profile-user links to include in this response.
      *   `:"start-index"` (*type:* `integer()`) - An index of the first profile-user link to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.EntityUserLinks{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_profile_user_links_list(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.EntityUserLinks.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_profile_user_links_list(
        connection,
        account_id,
        web_property_id,
        profile_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :"max-results" => :query,
      :"start-index" => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/entityUserLinks",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1),
          "profileId" => URI.encode(profile_id, &URI.char_unreserved?/1)
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.EntityUserLinks{}])
  end

  @doc """
  Updates permissions for an existing user on the given view (profile).

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID to update the user link for.
  *   `web_property_id` (*type:* `String.t`) - Web Property ID to update the user link for.
  *   `profile_id` (*type:* `String.t`) - View (Profile ID) to update the user link for.
  *   `link_id` (*type:* `String.t`) - Link ID to update the user link for.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:body` (*type:* `GoogleApi.Analytics.V3.Model.EntityUserLink.t`) - 
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.EntityUserLink{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_profile_user_links_update(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.EntityUserLink.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_profile_user_links_update(
        connection,
        account_id,
        web_property_id,
        profile_id,
        link_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :body => :body
    }

    request =
      Request.new()
      |> Request.method(:put)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/entityUserLinks/{linkId}",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1),
          "profileId" => URI.encode(profile_id, &URI.char_unreserved?/1),
          "linkId" => URI.encode(link_id, &(URI.char_unreserved?(&1) || &1 == ?/))
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.EntityUserLink{}])
  end

  @doc """
  Deletes a view (profile).

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID to delete the view (profile) for.
  *   `web_property_id` (*type:* `String.t`) - Web property ID to delete the view (profile) for.
  *   `profile_id` (*type:* `String.t`) - ID of the view (profile) to be deleted.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_profiles_delete(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) :: {:ok, nil} | {:ok, Tesla.Env.t()} | {:ok, list()} | {:error, any()}
  def analytics_management_profiles_delete(
        connection,
        account_id,
        web_property_id,
        profile_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query
    }

    request =
      Request.new()
      |> Request.method(:delete)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1),
          "profileId" => URI.encode(profile_id, &(URI.char_unreserved?(&1) || &1 == ?/))
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [decode: false])
  end

  @doc """
  Gets a view (profile) to which the user has access.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID to retrieve the view (profile) for.
  *   `web_property_id` (*type:* `String.t`) - Web property ID to retrieve the view (profile) for.
  *   `profile_id` (*type:* `String.t`) - View (Profile) ID to retrieve the view (profile) for.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.Profile{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_profiles_get(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.Profile.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_profiles_get(
        connection,
        account_id,
        web_property_id,
        profile_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1),
          "profileId" => URI.encode(profile_id, &(URI.char_unreserved?(&1) || &1 == ?/))
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.Profile{}])
  end

  @doc """
  Create a new view (profile).

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID to create the view (profile) for.
  *   `web_property_id` (*type:* `String.t`) - Web property ID to create the view (profile) for.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:body` (*type:* `GoogleApi.Analytics.V3.Model.Profile.t`) - 
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.Profile{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_profiles_insert(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.Profile.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_profiles_insert(
        connection,
        account_id,
        web_property_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :body => :body
    }

    request =
      Request.new()
      |> Request.method(:post)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/profiles",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1)
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.Profile{}])
  end

  @doc """
  Lists views (profiles) to which the user has access.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID for the view (profiles) to retrieve. Can either be a specific account ID or '~all', which refers to all the accounts to which the user has access.
  *   `web_property_id` (*type:* `String.t`) - Web property ID for the views (profiles) to retrieve. Can either be a specific web property ID or '~all', which refers to all the web properties to which the user has access.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:"max-results"` (*type:* `integer()`) - The maximum number of views (profiles) to include in this response.
      *   `:"start-index"` (*type:* `integer()`) - An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.Profiles{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_profiles_list(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.Profiles.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_profiles_list(
        connection,
        account_id,
        web_property_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :"max-results" => :query,
      :"start-index" => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/profiles",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1)
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.Profiles{}])
  end

  @doc """
  Updates an existing view (profile). This method supports patch semantics.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID to which the view (profile) belongs
  *   `web_property_id` (*type:* `String.t`) - Web property ID to which the view (profile) belongs
  *   `profile_id` (*type:* `String.t`) - ID of the view (profile) to be updated.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:body` (*type:* `GoogleApi.Analytics.V3.Model.Profile.t`) - 
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.Profile{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_profiles_patch(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.Profile.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_profiles_patch(
        connection,
        account_id,
        web_property_id,
        profile_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :body => :body
    }

    request =
      Request.new()
      |> Request.method(:patch)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1),
          "profileId" => URI.encode(profile_id, &(URI.char_unreserved?(&1) || &1 == ?/))
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.Profile{}])
  end

  @doc """
  Updates an existing view (profile).

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID to which the view (profile) belongs
  *   `web_property_id` (*type:* `String.t`) - Web property ID to which the view (profile) belongs
  *   `profile_id` (*type:* `String.t`) - ID of the view (profile) to be updated.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:body` (*type:* `GoogleApi.Analytics.V3.Model.Profile.t`) - 
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.Profile{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_profiles_update(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.Profile.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_profiles_update(
        connection,
        account_id,
        web_property_id,
        profile_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :body => :body
    }

    request =
      Request.new()
      |> Request.method(:put)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1),
          "profileId" => URI.encode(profile_id, &(URI.char_unreserved?(&1) || &1 == ?/))
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.Profile{}])
  end

  @doc """
  Delete a remarketing audience.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID to which the remarketing audience belongs.
  *   `web_property_id` (*type:* `String.t`) - Web property ID to which the remarketing audience belongs.
  *   `remarketing_audience_id` (*type:* `String.t`) - The ID of the remarketing audience to delete.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_remarketing_audience_delete(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) :: {:ok, nil} | {:ok, Tesla.Env.t()} | {:ok, list()} | {:error, any()}
  def analytics_management_remarketing_audience_delete(
        connection,
        account_id,
        web_property_id,
        remarketing_audience_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query
    }

    request =
      Request.new()
      |> Request.method(:delete)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/remarketingAudiences/{remarketingAudienceId}",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1),
          "remarketingAudienceId" =>
            URI.encode(remarketing_audience_id, &(URI.char_unreserved?(&1) || &1 == ?/))
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [decode: false])
  end

  @doc """
  Gets a remarketing audience to which the user has access.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - The account ID of the remarketing audience to retrieve.
  *   `web_property_id` (*type:* `String.t`) - The web property ID of the remarketing audience to retrieve.
  *   `remarketing_audience_id` (*type:* `String.t`) - The ID of the remarketing audience to retrieve.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.RemarketingAudience{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_remarketing_audience_get(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.RemarketingAudience.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_remarketing_audience_get(
        connection,
        account_id,
        web_property_id,
        remarketing_audience_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/remarketingAudiences/{remarketingAudienceId}",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1),
          "remarketingAudienceId" =>
            URI.encode(remarketing_audience_id, &(URI.char_unreserved?(&1) || &1 == ?/))
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.RemarketingAudience{}])
  end

  @doc """
  Creates a new remarketing audience.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - The account ID for which to create the remarketing audience.
  *   `web_property_id` (*type:* `String.t`) - Web property ID for which to create the remarketing audience.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:body` (*type:* `GoogleApi.Analytics.V3.Model.RemarketingAudience.t`) - 
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.RemarketingAudience{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_remarketing_audience_insert(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.RemarketingAudience.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_remarketing_audience_insert(
        connection,
        account_id,
        web_property_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :body => :body
    }

    request =
      Request.new()
      |> Request.method(:post)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/remarketingAudiences",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1)
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.RemarketingAudience{}])
  end

  @doc """
  Lists remarketing audiences to which the user has access.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - The account ID of the remarketing audiences to retrieve.
  *   `web_property_id` (*type:* `String.t`) - The web property ID of the remarketing audiences to retrieve.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:"max-results"` (*type:* `integer()`) - The maximum number of remarketing audiences to include in this response.
      *   `:"start-index"` (*type:* `integer()`) - An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
      *   `:type` (*type:* `String.t`) - 
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.RemarketingAudiences{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_remarketing_audience_list(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.RemarketingAudiences.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_remarketing_audience_list(
        connection,
        account_id,
        web_property_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :"max-results" => :query,
      :"start-index" => :query,
      :type => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/remarketingAudiences",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1)
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.RemarketingAudiences{}])
  end

  @doc """
  Updates an existing remarketing audience. This method supports patch semantics.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - The account ID of the remarketing audience to update.
  *   `web_property_id` (*type:* `String.t`) - The web property ID of the remarketing audience to update.
  *   `remarketing_audience_id` (*type:* `String.t`) - The ID of the remarketing audience to update.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:body` (*type:* `GoogleApi.Analytics.V3.Model.RemarketingAudience.t`) - 
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.RemarketingAudience{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_remarketing_audience_patch(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.RemarketingAudience.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_remarketing_audience_patch(
        connection,
        account_id,
        web_property_id,
        remarketing_audience_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :body => :body
    }

    request =
      Request.new()
      |> Request.method(:patch)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/remarketingAudiences/{remarketingAudienceId}",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1),
          "remarketingAudienceId" =>
            URI.encode(remarketing_audience_id, &(URI.char_unreserved?(&1) || &1 == ?/))
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.RemarketingAudience{}])
  end

  @doc """
  Updates an existing remarketing audience.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - The account ID of the remarketing audience to update.
  *   `web_property_id` (*type:* `String.t`) - The web property ID of the remarketing audience to update.
  *   `remarketing_audience_id` (*type:* `String.t`) - The ID of the remarketing audience to update.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:body` (*type:* `GoogleApi.Analytics.V3.Model.RemarketingAudience.t`) - 
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.RemarketingAudience{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_remarketing_audience_update(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.RemarketingAudience.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_remarketing_audience_update(
        connection,
        account_id,
        web_property_id,
        remarketing_audience_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :body => :body
    }

    request =
      Request.new()
      |> Request.method(:put)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/remarketingAudiences/{remarketingAudienceId}",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1),
          "remarketingAudienceId" =>
            URI.encode(remarketing_audience_id, &(URI.char_unreserved?(&1) || &1 == ?/))
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.RemarketingAudience{}])
  end

  @doc """
  Lists segments to which the user has access.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:"max-results"` (*type:* `integer()`) - The maximum number of segments to include in this response.
      *   `:"start-index"` (*type:* `integer()`) - An index of the first segment to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.Segments{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_segments_list(Tesla.Env.client(), keyword(), keyword()) ::
          {:ok, GoogleApi.Analytics.V3.Model.Segments.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_segments_list(connection, optional_params \\ [], opts \\ []) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :"max-results" => :query,
      :"start-index" => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url("/analytics/v3/management/segments", %{})
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.Segments{}])
  end

  @doc """
  Deletes an unsampled report.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID to delete the unsampled report for.
  *   `web_property_id` (*type:* `String.t`) - Web property ID to delete the unsampled reports for.
  *   `profile_id` (*type:* `String.t`) - View (Profile) ID to delete the unsampled report for.
  *   `unsampled_report_id` (*type:* `String.t`) - ID of the unsampled report to be deleted.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_unsampled_reports_delete(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) :: {:ok, nil} | {:ok, Tesla.Env.t()} | {:ok, list()} | {:error, any()}
  def analytics_management_unsampled_reports_delete(
        connection,
        account_id,
        web_property_id,
        profile_id,
        unsampled_report_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query
    }

    request =
      Request.new()
      |> Request.method(:delete)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/unsampledReports/{unsampledReportId}",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1),
          "profileId" => URI.encode(profile_id, &URI.char_unreserved?/1),
          "unsampledReportId" =>
            URI.encode(unsampled_report_id, &(URI.char_unreserved?(&1) || &1 == ?/))
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [decode: false])
  end

  @doc """
  Returns a single unsampled report.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID to retrieve unsampled report for.
  *   `web_property_id` (*type:* `String.t`) - Web property ID to retrieve unsampled reports for.
  *   `profile_id` (*type:* `String.t`) - View (Profile) ID to retrieve unsampled report for.
  *   `unsampled_report_id` (*type:* `String.t`) - ID of the unsampled report to retrieve.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.UnsampledReport{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_unsampled_reports_get(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.UnsampledReport.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_unsampled_reports_get(
        connection,
        account_id,
        web_property_id,
        profile_id,
        unsampled_report_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/unsampledReports/{unsampledReportId}",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1),
          "profileId" => URI.encode(profile_id, &URI.char_unreserved?/1),
          "unsampledReportId" =>
            URI.encode(unsampled_report_id, &(URI.char_unreserved?(&1) || &1 == ?/))
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.UnsampledReport{}])
  end

  @doc """
  Create a new unsampled report.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID to create the unsampled report for.
  *   `web_property_id` (*type:* `String.t`) - Web property ID to create the unsampled report for.
  *   `profile_id` (*type:* `String.t`) - View (Profile) ID to create the unsampled report for.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:body` (*type:* `GoogleApi.Analytics.V3.Model.UnsampledReport.t`) - 
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.UnsampledReport{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_unsampled_reports_insert(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.UnsampledReport.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_unsampled_reports_insert(
        connection,
        account_id,
        web_property_id,
        profile_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :body => :body
    }

    request =
      Request.new()
      |> Request.method(:post)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/unsampledReports",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1),
          "profileId" => URI.encode(profile_id, &URI.char_unreserved?/1)
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.UnsampledReport{}])
  end

  @doc """
  Lists unsampled reports to which the user has access.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID to retrieve unsampled reports for. Must be a specific account ID, ~all is not supported.
  *   `web_property_id` (*type:* `String.t`) - Web property ID to retrieve unsampled reports for. Must be a specific web property ID, ~all is not supported.
  *   `profile_id` (*type:* `String.t`) - View (Profile) ID to retrieve unsampled reports for. Must be a specific view (profile) ID, ~all is not supported.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:"max-results"` (*type:* `integer()`) - The maximum number of unsampled reports to include in this response.
      *   `:"start-index"` (*type:* `integer()`) - An index of the first unsampled report to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.UnsampledReports{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_unsampled_reports_list(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.UnsampledReports.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_unsampled_reports_list(
        connection,
        account_id,
        web_property_id,
        profile_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :"max-results" => :query,
      :"start-index" => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/profiles/{profileId}/unsampledReports",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1),
          "profileId" => URI.encode(profile_id, &URI.char_unreserved?/1)
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.UnsampledReports{}])
  end

  @doc """
  Delete data associated with a previous upload.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account Id for the uploads to be deleted.
  *   `web_property_id` (*type:* `String.t`) - Web property Id for the uploads to be deleted.
  *   `custom_data_source_id` (*type:* `String.t`) - Custom data source Id for the uploads to be deleted.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:body` (*type:* `GoogleApi.Analytics.V3.Model.AnalyticsDataimportDeleteUploadDataRequest.t`) - 
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_uploads_delete_upload_data(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) :: {:ok, nil} | {:ok, Tesla.Env.t()} | {:ok, list()} | {:error, any()}
  def analytics_management_uploads_delete_upload_data(
        connection,
        account_id,
        web_property_id,
        custom_data_source_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :body => :body
    }

    request =
      Request.new()
      |> Request.method(:post)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/customDataSources/{customDataSourceId}/deleteUploadData",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1),
          "customDataSourceId" => URI.encode(custom_data_source_id, &URI.char_unreserved?/1)
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [decode: false])
  end

  @doc """
  List uploads to which the user has access.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account Id for the upload to retrieve.
  *   `web_property_id` (*type:* `String.t`) - Web property Id for the upload to retrieve.
  *   `custom_data_source_id` (*type:* `String.t`) - Custom data source Id for upload to retrieve.
  *   `upload_id` (*type:* `String.t`) - Upload Id to retrieve.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.Upload{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_uploads_get(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.Upload.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_uploads_get(
        connection,
        account_id,
        web_property_id,
        custom_data_source_id,
        upload_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/customDataSources/{customDataSourceId}/uploads/{uploadId}",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1),
          "customDataSourceId" => URI.encode(custom_data_source_id, &URI.char_unreserved?/1),
          "uploadId" => URI.encode(upload_id, &(URI.char_unreserved?(&1) || &1 == ?/))
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.Upload{}])
  end

  @doc """
  List uploads to which the user has access.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account Id for the uploads to retrieve.
  *   `web_property_id` (*type:* `String.t`) - Web property Id for the uploads to retrieve.
  *   `custom_data_source_id` (*type:* `String.t`) - Custom data source Id for uploads to retrieve.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:"max-results"` (*type:* `integer()`) - The maximum number of uploads to include in this response.
      *   `:"start-index"` (*type:* `integer()`) - A 1-based index of the first upload to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.Uploads{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_uploads_list(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.Uploads.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_uploads_list(
        connection,
        account_id,
        web_property_id,
        custom_data_source_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :"max-results" => :query,
      :"start-index" => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/customDataSources/{customDataSourceId}/uploads",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1),
          "customDataSourceId" => URI.encode(custom_data_source_id, &URI.char_unreserved?/1)
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.Uploads{}])
  end

  @doc """
  Upload data for a custom data source.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account Id associated with the upload.
  *   `web_property_id` (*type:* `String.t`) - Web property UA-string associated with the upload.
  *   `custom_data_source_id` (*type:* `String.t`) - Custom data source Id to which the data being uploaded belongs.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.Upload{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_uploads_upload_data(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.Upload.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_uploads_upload_data(
        connection,
        account_id,
        web_property_id,
        custom_data_source_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query
    }

    request =
      Request.new()
      |> Request.method(:post)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/customDataSources/{customDataSourceId}/uploads",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1),
          "customDataSourceId" => URI.encode(custom_data_source_id, &URI.char_unreserved?/1)
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.Upload{}])
  end

  @doc """
  Upload data for a custom data source.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account Id associated with the upload.
  *   `web_property_id` (*type:* `String.t`) - Web property UA-string associated with the upload.
  *   `custom_data_source_id` (*type:* `String.t`) - Custom data source Id to which the data being uploaded belongs.
  *   `upload_type` (*type:* `String.t`) - Upload type. Must be "multipart".
  *   `metadata` (*type:* `String.t`) - string metadata
  *   `data` (*type:* `iodata`) - Content to upload, as a string or iolist
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.Upload{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_uploads_upload_data_iodata(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          String.t(),
          String.t(),
          iodata,
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.Upload.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_uploads_upload_data_iodata(
        connection,
        account_id,
        web_property_id,
        custom_data_source_id,
        upload_type,
        metadata,
        data,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query
    }

    request =
      Request.new()
      |> Request.method(:post)
      |> Request.url(
        "/upload/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/customDataSources/{customDataSourceId}/uploads",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1),
          "customDataSourceId" => URI.encode(custom_data_source_id, &URI.char_unreserved?/1)
        }
      )
      |> Request.add_param(:query, :uploadType, upload_type)
      |> Request.add_param(:body, :metadata, metadata)
      |> Request.add_param(:body, :data, data)
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.Upload{}])
  end

  @doc """
  Upload data for a custom data source.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account Id associated with the upload.
  *   `web_property_id` (*type:* `String.t`) - Web property UA-string associated with the upload.
  *   `custom_data_source_id` (*type:* `String.t`) - Custom data source Id to which the data being uploaded belongs.
  *   `upload_type` (*type:* `String.t`) - Upload type. Must be "resumable".
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_uploads_upload_data_resumable(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) :: {:ok, nil} | {:ok, Tesla.Env.t()} | {:ok, list()} | {:error, any()}
  def analytics_management_uploads_upload_data_resumable(
        connection,
        account_id,
        web_property_id,
        custom_data_source_id,
        upload_type,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query
    }

    request =
      Request.new()
      |> Request.method(:post)
      |> Request.url(
        "/resumable/upload/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/customDataSources/{customDataSourceId}/uploads",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1),
          "customDataSourceId" => URI.encode(custom_data_source_id, &URI.char_unreserved?/1)
        }
      )
      |> Request.add_param(:query, :uploadType, upload_type)
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [decode: false])
  end

  @doc """
  Upload data for a custom data source.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account Id associated with the upload.
  *   `web_property_id` (*type:* `String.t`) - Web property UA-string associated with the upload.
  *   `custom_data_source_id` (*type:* `String.t`) - Custom data source Id to which the data being uploaded belongs.
  *   `upload_type` (*type:* `String.t`) - Upload type. Must be "multipart".
  *   `metadata` (*type:* `String.t`) - string metadata
  *   `data` (*type:* `String.t`) - Path to file containing content to upload
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.Upload{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_uploads_upload_data_simple(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          String.t(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.Upload.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_uploads_upload_data_simple(
        connection,
        account_id,
        web_property_id,
        custom_data_source_id,
        upload_type,
        metadata,
        data,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query
    }

    request =
      Request.new()
      |> Request.method(:post)
      |> Request.url(
        "/upload/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/customDataSources/{customDataSourceId}/uploads",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1),
          "customDataSourceId" => URI.encode(custom_data_source_id, &URI.char_unreserved?/1)
        }
      )
      |> Request.add_param(:query, :uploadType, upload_type)
      |> Request.add_param(:body, :metadata, metadata)
      |> Request.add_param(:file, :data, data)
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.Upload{}])
  end

  @doc """
  Deletes a web property-Google Ads link.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - ID of the account which the given web property belongs to.
  *   `web_property_id` (*type:* `String.t`) - Web property ID to delete the Google Ads link for.
  *   `web_property_ad_words_link_id` (*type:* `String.t`) - Web property Google Ads link ID.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_web_property_ad_words_links_delete(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) :: {:ok, nil} | {:ok, Tesla.Env.t()} | {:ok, list()} | {:error, any()}
  def analytics_management_web_property_ad_words_links_delete(
        connection,
        account_id,
        web_property_id,
        web_property_ad_words_link_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query
    }

    request =
      Request.new()
      |> Request.method(:delete)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/entityAdWordsLinks/{webPropertyAdWordsLinkId}",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1),
          "webPropertyAdWordsLinkId" =>
            URI.encode(web_property_ad_words_link_id, &(URI.char_unreserved?(&1) || &1 == ?/))
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [decode: false])
  end

  @doc """
  Returns a web property-Google Ads link to which the user has access.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - ID of the account which the given web property belongs to.
  *   `web_property_id` (*type:* `String.t`) - Web property ID to retrieve the Google Ads link for.
  *   `web_property_ad_words_link_id` (*type:* `String.t`) - Web property-Google Ads link ID.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.EntityAdWordsLink{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_web_property_ad_words_links_get(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.EntityAdWordsLink.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_web_property_ad_words_links_get(
        connection,
        account_id,
        web_property_id,
        web_property_ad_words_link_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/entityAdWordsLinks/{webPropertyAdWordsLinkId}",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1),
          "webPropertyAdWordsLinkId" =>
            URI.encode(web_property_ad_words_link_id, &(URI.char_unreserved?(&1) || &1 == ?/))
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.EntityAdWordsLink{}])
  end

  @doc """
  Creates a webProperty-Google Ads link.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - ID of the Google Analytics account to create the link for.
  *   `web_property_id` (*type:* `String.t`) - Web property ID to create the link for.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:body` (*type:* `GoogleApi.Analytics.V3.Model.EntityAdWordsLink.t`) - 
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.EntityAdWordsLink{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_web_property_ad_words_links_insert(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.EntityAdWordsLink.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_web_property_ad_words_links_insert(
        connection,
        account_id,
        web_property_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :body => :body
    }

    request =
      Request.new()
      |> Request.method(:post)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/entityAdWordsLinks",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1)
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.EntityAdWordsLink{}])
  end

  @doc """
  Lists webProperty-Google Ads links for a given web property.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - ID of the account which the given web property belongs to.
  *   `web_property_id` (*type:* `String.t`) - Web property ID to retrieve the Google Ads links for.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:"max-results"` (*type:* `integer()`) - The maximum number of webProperty-Google Ads links to include in this response.
      *   `:"start-index"` (*type:* `integer()`) - An index of the first webProperty-Google Ads link to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.EntityAdWordsLinks{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_web_property_ad_words_links_list(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.EntityAdWordsLinks.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_web_property_ad_words_links_list(
        connection,
        account_id,
        web_property_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :"max-results" => :query,
      :"start-index" => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/entityAdWordsLinks",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1)
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.EntityAdWordsLinks{}])
  end

  @doc """
  Updates an existing webProperty-Google Ads link. This method supports patch semantics.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - ID of the account which the given web property belongs to.
  *   `web_property_id` (*type:* `String.t`) - Web property ID to retrieve the Google Ads link for.
  *   `web_property_ad_words_link_id` (*type:* `String.t`) - Web property-Google Ads link ID.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:body` (*type:* `GoogleApi.Analytics.V3.Model.EntityAdWordsLink.t`) - 
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.EntityAdWordsLink{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_web_property_ad_words_links_patch(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.EntityAdWordsLink.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_web_property_ad_words_links_patch(
        connection,
        account_id,
        web_property_id,
        web_property_ad_words_link_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :body => :body
    }

    request =
      Request.new()
      |> Request.method(:patch)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/entityAdWordsLinks/{webPropertyAdWordsLinkId}",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1),
          "webPropertyAdWordsLinkId" =>
            URI.encode(web_property_ad_words_link_id, &(URI.char_unreserved?(&1) || &1 == ?/))
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.EntityAdWordsLink{}])
  end

  @doc """
  Updates an existing webProperty-Google Ads link.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - ID of the account which the given web property belongs to.
  *   `web_property_id` (*type:* `String.t`) - Web property ID to retrieve the Google Ads link for.
  *   `web_property_ad_words_link_id` (*type:* `String.t`) - Web property-Google Ads link ID.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:body` (*type:* `GoogleApi.Analytics.V3.Model.EntityAdWordsLink.t`) - 
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.EntityAdWordsLink{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_web_property_ad_words_links_update(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.EntityAdWordsLink.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_web_property_ad_words_links_update(
        connection,
        account_id,
        web_property_id,
        web_property_ad_words_link_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :body => :body
    }

    request =
      Request.new()
      |> Request.method(:put)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/entityAdWordsLinks/{webPropertyAdWordsLinkId}",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1),
          "webPropertyAdWordsLinkId" =>
            URI.encode(web_property_ad_words_link_id, &(URI.char_unreserved?(&1) || &1 == ?/))
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.EntityAdWordsLink{}])
  end

  @doc """
  Gets a web property to which the user has access.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID to retrieve the web property for.
  *   `web_property_id` (*type:* `String.t`) - ID to retrieve the web property for.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.Webproperty{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_webproperties_get(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.Webproperty.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_webproperties_get(
        connection,
        account_id,
        web_property_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &(URI.char_unreserved?(&1) || &1 == ?/))
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.Webproperty{}])
  end

  @doc """
  Create a new property if the account has fewer than 20 properties. Web properties are visible in the Google Analytics interface only if they have at least one profile.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID to create the web property for.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:body` (*type:* `GoogleApi.Analytics.V3.Model.Webproperty.t`) - 
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.Webproperty{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_webproperties_insert(
          Tesla.Env.client(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.Webproperty.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_webproperties_insert(
        connection,
        account_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :body => :body
    }

    request =
      Request.new()
      |> Request.method(:post)
      |> Request.url("/analytics/v3/management/accounts/{accountId}/webproperties", %{
        "accountId" => URI.encode(account_id, &URI.char_unreserved?/1)
      })
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.Webproperty{}])
  end

  @doc """
  Lists web properties to which the user has access.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID to retrieve web properties for. Can either be a specific account ID or '~all', which refers to all the accounts that user has access to.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:"max-results"` (*type:* `integer()`) - The maximum number of web properties to include in this response.
      *   `:"start-index"` (*type:* `integer()`) - An index of the first entity to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.Webproperties{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_webproperties_list(
          Tesla.Env.client(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.Webproperties.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_webproperties_list(
        connection,
        account_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :"max-results" => :query,
      :"start-index" => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url("/analytics/v3/management/accounts/{accountId}/webproperties", %{
        "accountId" => URI.encode(account_id, &URI.char_unreserved?/1)
      })
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.Webproperties{}])
  end

  @doc """
  Updates an existing web property. This method supports patch semantics.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID to which the web property belongs
  *   `web_property_id` (*type:* `String.t`) - Web property ID
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:body` (*type:* `GoogleApi.Analytics.V3.Model.Webproperty.t`) - 
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.Webproperty{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_webproperties_patch(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.Webproperty.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_webproperties_patch(
        connection,
        account_id,
        web_property_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :body => :body
    }

    request =
      Request.new()
      |> Request.method(:patch)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &(URI.char_unreserved?(&1) || &1 == ?/))
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.Webproperty{}])
  end

  @doc """
  Updates an existing web property.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID to which the web property belongs
  *   `web_property_id` (*type:* `String.t`) - Web property ID
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:body` (*type:* `GoogleApi.Analytics.V3.Model.Webproperty.t`) - 
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.Webproperty{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_webproperties_update(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.Webproperty.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_webproperties_update(
        connection,
        account_id,
        web_property_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :body => :body
    }

    request =
      Request.new()
      |> Request.method(:put)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &(URI.char_unreserved?(&1) || &1 == ?/))
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.Webproperty{}])
  end

  @doc """
  Removes a user from the given web property.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID to delete the user link for.
  *   `web_property_id` (*type:* `String.t`) - Web Property ID to delete the user link for.
  *   `link_id` (*type:* `String.t`) - Link ID to delete the user link for.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_webproperty_user_links_delete(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) :: {:ok, nil} | {:ok, Tesla.Env.t()} | {:ok, list()} | {:error, any()}
  def analytics_management_webproperty_user_links_delete(
        connection,
        account_id,
        web_property_id,
        link_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query
    }

    request =
      Request.new()
      |> Request.method(:delete)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/entityUserLinks/{linkId}",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1),
          "linkId" => URI.encode(link_id, &(URI.char_unreserved?(&1) || &1 == ?/))
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [decode: false])
  end

  @doc """
  Adds a new user to the given web property.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID to create the user link for.
  *   `web_property_id` (*type:* `String.t`) - Web Property ID to create the user link for.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:body` (*type:* `GoogleApi.Analytics.V3.Model.EntityUserLink.t`) - 
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.EntityUserLink{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_webproperty_user_links_insert(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.EntityUserLink.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_webproperty_user_links_insert(
        connection,
        account_id,
        web_property_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :body => :body
    }

    request =
      Request.new()
      |> Request.method(:post)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/entityUserLinks",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1)
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.EntityUserLink{}])
  end

  @doc """
  Lists webProperty-user links for a given web property.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID which the given web property belongs to.
  *   `web_property_id` (*type:* `String.t`) - Web Property ID for the webProperty-user links to retrieve. Can either be a specific web property ID or '~all', which refers to all the web properties that user has access to.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:"max-results"` (*type:* `integer()`) - The maximum number of webProperty-user Links to include in this response.
      *   `:"start-index"` (*type:* `integer()`) - An index of the first webProperty-user link to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.EntityUserLinks{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_webproperty_user_links_list(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.EntityUserLinks.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_webproperty_user_links_list(
        connection,
        account_id,
        web_property_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :"max-results" => :query,
      :"start-index" => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/entityUserLinks",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1)
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.EntityUserLinks{}])
  end

  @doc """
  Updates permissions for an existing user on the given web property.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.Analytics.V3.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account ID to update the account-user link for.
  *   `web_property_id` (*type:* `String.t`) - Web property ID to update the account-user link for.
  *   `link_id` (*type:* `String.t`) - Link ID to update the account-user link for.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:body` (*type:* `GoogleApi.Analytics.V3.Model.EntityUserLink.t`) - 
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.Analytics.V3.Model.EntityUserLink{}}` on success
  *   `{:error, info}` on failure
  """
  @spec analytics_management_webproperty_user_links_update(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.Analytics.V3.Model.EntityUserLink.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def analytics_management_webproperty_user_links_update(
        connection,
        account_id,
        web_property_id,
        link_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :body => :body
    }

    request =
      Request.new()
      |> Request.method(:put)
      |> Request.url(
        "/analytics/v3/management/accounts/{accountId}/webproperties/{webPropertyId}/entityUserLinks/{linkId}",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "webPropertyId" => URI.encode(web_property_id, &URI.char_unreserved?/1),
          "linkId" => URI.encode(link_id, &(URI.char_unreserved?(&1) || &1 == ?/))
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.Analytics.V3.Model.EntityUserLink{}])
  end
end
